package com.tg.app.view;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.tg.app.R;
import com.tg.appcommon.android.TGLog;

public class ImageBlurView extends RelativeLayout {
    private static final String TAG = ImageBlurView.class.getSimpleName();
    private Drawable mMaker;

    public ImageBlurView(Context context) {
        super(context);
        initContentView(context);
    }

    public ImageBlurView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public ImageBlurView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initParam(context, attrs);
        initContentView(context);
    }


    private void initParam(Context context, @Nullable AttributeSet attrs) {
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ImageBlurView);
        mMaker = typedArray.getDrawable(R.styleable.ImageBlurView_srcMaker);
        typedArray.recycle();
    }

    private void initContentView(Context context) {
        View rootView = LayoutInflater.from(context).inflate(R.layout.layout_player_button_view, this, true);
        ImageButton imageButton = rootView.findViewById(R.id.btn_image);
        imageButton.setBackground(mMaker);
    }

}
